    <ul>
    <?php //$arBranch = Category::getBranchById($id); ?>
    <?php $arCategories = Category::getRealList($id); ?>
    
    <?php //debugvar($id, 'id'); ?>
    <?php //debugvar($arParentsId, 'arParentsId'); ?>
    
    <?php foreach( $arCategories as $category ): ?>

    <?php //$find = array_search($category->getId(), $arParentsId); ?>

        <?php //debugvar($category->getId(), 'Category'); ?>
        <?php //debugvar($id, 'id'); ?>
            
        <?php if(array_search($category->getId(), $arParentsId) !== false or $category->getId() == $id): ?>
            <?php $a_class = ' class="active_a2"'; ?>
            <?php $li_class = ' class="active2"'; ?>
            <?php //debugvar($li_class, 'li_class'); ?>
        <?php else: ?>
            <?php $a_class = ''; ?>
            <?php $li_class = ''; ?>
        <?php endif;?>

        <?php if($category->getChildrenQnt()): ?>
                <?php echo link_to_remote(
                                '<li' . $li_class . '>' . $category->getName() . '</li>'
                                , array(
                                    'update' => 'category_child_'.$category->getId()
                                    , 'url' => 'category/detail?id='.$category->getId()
                                                                   . '&arParentsId=' . $arParentsId
                                    , )
                                    ); ?>
                <?php //debugvar($category, 'Category'); ?>

        <?php else: ?>
                <?php echo link_to(
                                '<li' . $li_class . '>' . $category->getName() . '</li>'
                                , 'product/list?id=' . $category->getId()
                                    ); ?>
        <?php endif; ?>
            
        <div id="category_child_<?php echo $category->getId() ?>" class="submenu"></div>

       <?php if($a_class): ?>
            <?php include_partial(
                                    'product/menu_detail'
                                    , array(
                                            'id' => $category->getId()
                                            , 'arParentsId' => $arParentsId
                                            )) ?>
        <?php endif; ?>
 
    <?php endforeach; ?>
    </ul>
